
' --------------------------------------------------------------------
' ---    INTO THE FIGHT (Where did I found these damn titles?!)    ---
' --- A Pure Qbasic Demo by Michael Kargas aka Optimus/Dirty Minds ---
' ---     Read the Note. Don't read the code (Baxalokodikas :P)    ---
' ---        http://www.fortunecity.com/skyscraper/black/791       ---
' ---                      mkargas@hotmail.com                     ---
' --------------------------------------------------------------------

DECLARE SUB blurtext ()
DECLARE SUB blackbox (x1%, y1%, x2%, y2%)
DECLARE SUB img0 (f$)
DECLARE SUB pal0 (a$)
DECLARE SUB pallete (pl%)
DECLARE SUB plasmas (ps%, xl%, yl%, xp%, yp%)
DECLARE SUB rotozoom (angle%, zf%, xl%, yl%)
DECLARE SUB sines (sn%)
DECLARE SUB delay (a%)
DECLARE SUB preparewriter (pg%)
DECLARE SUB testwriter ()
DECLARE SUB writetext (xtp%, ytp%, lne%, ag%, bg%, xel%, xmeg%, yel%, ymeg%)
DECLARE SUB physix (toing%, pn%)
DECLARE SUB palget ()
DECLARE SUB fadefromcolor (a, c, t, r, g, b)
DECLARE SUB fadetocolor (a, c, t, r, g, b)
DECLARE SUB fadetocolorscale (a, c, t, r, g, b)
DECLARE SUB startcpumeter ()
DECLARE SUB endcpumeter (bgc%)
DECLARE SUB text2array (lne%, tsa%)
DECLARE SUB zoomebaby (zf)
DECLARE SUB blurtext ()
DECLARE SUB physix2 ()

SCREEN 12

PRINT "I am crazy! :)"
PRINT "--------------"
PRINT "I had learned doing such fx in Qbasic with my friend Javier."
PRINT "We wanted to do the best Qbasic demo ever. But we left the project.."
PRINT "I later connected my own effects and wanted to send to a compo called Qlympics!"
PRINT "But where is Qlympics??? Damn! Something happened with Qlympics so I decided that this will go for Toshi's compo.."
PRINT
PRINT "1) I have an Elitegroup intro, a boring introduction and the main demo"
PRINT "2) Press SPACE to go to next part. Press ESCAPE to quit totally.."
PRINT "3) In the next screen you can choose Vsync On/Off and other things too.."
PRINT "4) This is the final version of this demo. It contains an electronic note (Similar logic which I love, like Crystal Dream 2 or the C64 demos) with many many Greetings and many other stuff.."
PRINT "5) I think I will be back on Qbasic democoding. It's Funny and Challenging. Many of the fx in this demo could be faster if I didn't had problems with memory which made me use Dynamic Arrays in some cases.."
PRINT "7) I just have some serious demoprojects on CPC and PC 4now. And some crazy pages too. So perhaps you will not see me too often in Qbasic,. perhaps later..."
PRINT
PRINT "I hope that it works. Press any key to go to the next screen."
PRINT "May the beauty be with you!"
PRINT "Michael Kargas aka Optimus/Dirty Minds/the Lab  -  mkargas@hotmail.com"
PRINT "http://www.fortunecity.com/skyscraper/black/791"

WHILE a$ = "": a$ = INKEY$: WEND

CLS

LOCATE 1, 1:
PRINT "Vsync:": PRINT
PRINT " 0) Enabled"
PRINT " 1) Enabled with CPU Meter"
PRINT " 2) Disabled in the most Critical Parts"
PRINT " 3) Disabled in more Critical Parts"
PRINT " 4) Disabled in less Critical Parts"
PRINT " 5) Totally Disabled"


PRINT
PRINT " Choose 0 if you are running it for the 1st time.. (Just press Enter :)"
PRINT " Choose 1 for a CPU Meter based on Rasters/Cooper"
PRINT " Choose 2 to disable it in the most critical parts like the Rotozoomer"
PRINT " Choose 3 to disable it in parts at least critical as Feedback"
PRINT " Choose 4 to disable it in less Critical Parts like Plasma or Fire"
PRINT " Choose 5 for Speed Disaster!": PRINT
PRINT "(If it is disabled in less critical then it is in more critical too..)"
PRINT "I put all these options because in my PC some parts slow down from 70 to 35fps.."
PRINT "Of course I know why that happens but I didn't knew any other way to sync than wait&h3da, so..."
PRINT
INPUT "Choose your Destiny!"; vsync%




DIM SHARED txt%(10, 20)
a% = 64
DIM SHARED ltr%(a%, 16, 16)
DIM SHARED xp%(12), x(12), v(12), ep(12), epe(12), f(12), t(12), el(12), kat%(12)
DIM SHARED r(255), g(255), b(255)
xg% = 32000
DIM SHARED c%(xg%)
DIM SHARED div%(0 TO 1024)
DIM fdiv%(-61 TO 61)
DIM p61%(-61 TO 61)
DIM pf61%(-61 TO 61)
DIM pdiv%(255)
DIM sp%(16, 16)
DIM SHARED fsin1%(-1024 TO 1024)
DIM SHARED fsin2%(-1024 TO 1024)
DIM SHARED fsin3%(-1024 TO 1024)
DIM SHARED ax1%(-161 TO 160), ax2%(-161 TO 160)
DIM SHARED ay1%(-101 TO 100), ay2%(-101 TO 100)
DIM SHARED lx1%(-161 TO 160), lx2%(-161 TO 160)
DIM SHARED ly1%(-101 TO 100), ly2%(-101 TO 100)

'4=disabled developers mode 3=disabled totally 2=partially disabled 1=enabled with CPU meter 0=enabled




FOR i% = 0 TO 255
pdiv%(i%) = i% \ 2 + 128
NEXT i%

FOR i% = -61 TO 61
p61%(i%) = i% * 61
NEXT i%

FOR i% = -61 TO 61
fdiv%(i%) = i% / 4
NEXT i%

FOR i% = -61 TO 61
pf61%(i%) = p61%(fdiv%(i%))
NEXT i%

FOR i% = 0 TO 1024
div%(i%) = i% \ 4 - 3
IF div%(i%) < 0 THEN div%(i%) = 0
NEXT i%


SCREEN 13


'GOTO 317337

REM ------------ Pallete settings --------------

FOR i% = 1 TO 16
OUT &H3C8, i%
OUT &H3C9, (16 - i%) * 4 + 3
OUT &H3C9, (16 - i%) * 4 + 3
OUT &H3C9, (16 - i%) * 4 + 3
NEXT i%
COLOR 16

FOR i% = 32 TO 47
OUT &H3C8, i%
OUT &H3C9, (47 - i%) * 4
OUT &H3C9, (47 - i%) * 4
OUT &H3C9, (47 - i%) * 4
NEXT i%

FOR i% = 48 TO 63
OUT &H3C8, i%
OUT &H3C9, (i% - 63) * 4
OUT &H3C9, (i% - 63) * 4
OUT &H3C9, (i% - 63) * 4
NEXT i%

FOR i% = 64 TO 95
OUT &H3C8, i%
OUT &H3C9, 127 - i%
OUT &H3C9, 127 - i%
OUT &H3C9, i% - 64
NEXT i%

FOR i% = 96 TO 127
OUT &H3C8, i%
OUT &H3C9, 127 - i%
OUT &H3C9, 127 - i%
OUT &H3C9, i% - 64
NEXT i%

FOR i% = 128 TO 255
OUT &H3C8, i%
OUT &H3C9, (i% - 128) \ 6
OUT &H3C9, (i% - 128) \ 4
OUT &H3C9, (i% - 128) \ 2
NEXT i%


palget

pg% = 1
preparewriter pg%


FOR y% = 1 TO 16
FOR x% = 1 TO 16
IF ltr%(1, x%, y%) < 4 THEN sp%(x%, y%) = 0 ELSE sp%(x%, y%) = 255
NEXT x%
NEXT y%



REM ------------------ Simple Fade --------------------


FOR i% = 0 TO 255

OUT &H3C8, 0
OUT &H3C9, i% \ 4
OUT &H3C9, i% \ 4
OUT &H3C9, i% \ 4

aaa$ = INKEY$
IF aaa$ = CHR$(27) THEN GOTO 7447
IF aaa$ = " " THEN GOTO 303


IF vsync% < 5 THEN WAIT &H3DA, 8: WAIT &H3DA, 8, 8

NEXT i%

delay 140

REM ---------------- Lines -------------------


x(1) = 0
v(1) = 1
ep(1) = 0
epe(1) = -.0000087

DO WHILE v(1) >= 0
aaa$ = INKEY$
IF aaa$ = CHR$(27) THEN GOTO 7447
IF aaa$ = " " THEN GOTO 303

physix 4, 1

LINE (xp%(1), 12)-(xp%(1) + 1, 12), 15
LINE (xp%(1), 142)-(xp%(1) + 1, 142), 15

LINE (320 - xp%(1), 52)-(319 - xp%(1), 52), 15
LINE (320 - xp%(1), 182)-(319 - xp%(1), 182), 15

IF vsync% < 5 THEN WAIT &H3DA, 8: WAIT &H3DA, 8, 8

LOOP


REM ----------------- Squares and Qdomination logo --------------------

FOR i% = 16 TO 63
OUT &H3C8, i%
OUT &H3C9, 63
OUT &H3C9, 63
OUT &H3C9, 63
NEXT i%


REM -------- Antialiased Circle Q ------------


FOR y% = 65 TO 131
FOR x% = 224 TO 288

c = SQR((x% - 256) ^ 2 + (y% - 100) ^ 2)
IF c < 30 THEN c% = 0 ELSE IF c <= 32 THEN c% = (32 - c) * 16 + 30 ELSE c% = 0
PSET (x%, y% - 3), c%

NEXT x%
NEXT y%

LINE (270, 111)-(286, 127), 48
LINE (270, 110)-(286, 126), 48
LINE (270, 109)-(286, 125), 48


REM  ------------------- Boxes --------------------

LINE (32, 65)-(96, 129), 16, B
LINE (128, 65)-(192, 129), 16, B
LINE (224, 65)-(288, 129), 16, B

LINE (30, 62)-(98, 132), 17, B
LINE (29, 63)-(99, 131), 17, B
LINE (126, 62)-(194, 132), 18, B
LINE (125, 63)-(195, 131), 18, B
LINE (222, 62)-(290, 132), 19, B
LINE (221, 63)-(291, 131), 19, B


delay 140


REM ------------------ Gramata pano --------------------

xp%(1) = 320
x(1) = 320
v(1) = -3
ep(1) = .014

xp%(2) = 651
x(2) = 651
v(2) = -4
ep(2) = .0148

xp%(3) = 951
x(3) = 951
v(3) = -5
ep(3) = .01625

xp%(4) = 1157
x(4) = 1157
v(4) = -6
ep(4) = .0189

xp%(5) = 831
x(5) = 831
v(5) = -5
ep(5) = .015


xp%(6) = 1109
x(6) = 1109
v(6) = -6
ep(6) = .018



DO WHILE v(6) < 0

aaa$ = INKEY$
IF aaa$ = CHR$(27) THEN GOTO 7447
IF aaa$ = " " THEN GOTO 303

IF v(1) >= 0 THEN v(1) = 0: ep(1) = 0
IF v(2) >= 0 THEN v(2) = 0: ep(2) = 0
IF v(3) >= 0 THEN v(3) = 0: ep(3) = 0
IF v(4) >= 0 THEN v(4) = 0: ep(4) = 0
IF v(5) >= 0 THEN v(5) = 0: ep(5) = 0
IF v(6) >= 0 THEN v(6) = 0: ep(6) = 0

physix 3, 1
physix 3, 2
physix 3, 3
physix 3, 4
physix 3, 5
physix 3, 6

writetext xp%(1), 16, 1, 1, 7, 0, 319, 0, 199
writetext xp%(2), 16, 1, 8, 11, 0, 319, 0, 199
writetext xp%(3), 16, 1, 12, 12, 0, 319, 0, 199
writetext xp%(4), 16, 1, 13, 17, 0, 319, 0, 199
writetext xp%(5), 32, 2, 1, 6, 0, 319, 0, 199
writetext xp%(6), 32, 2, 7, 17, 0, 319, 0, 199

IF vsync% = 1 THEN endcpumeter (63)
IF vsync% < 5 THEN WAIT &H3DA, 8: WAIT &H3DA, 8, 8
IF vsync% = 1 THEN startcpumeter

LOOP
endcpumeter (63)


REM ------------------ Gramata kato --------------------


delay 70

xp%(7) = 320
x(7) = 320
v(7) = -3
ep(7) = .014

xp%(8) = 599
x(8) = 599
v(8) = -4
ep(8) = .0169

xp%(9) = 442
x(9) = 442
v(9) = -4
ep(9) = .018

xp%(10) = 669
x(10) = 669
v(10) = -5
ep(10) = .0224

xp%(11) = 888
x(11) = 888
v(11) = -6
ep(11) = .0236

xp%(12) = 1200
x(12) = 1200
v(12) = -7
ep(12) = .025



DO WHILE v(12) < 0

aaa$ = INKEY$
IF aaa$ = CHR$(27) THEN GOTO 7447
IF aaa$ = " " THEN GOTO 303

IF v(7) >= 0 THEN v(7) = 0: ep(7) = 0
IF v(8) >= 0 THEN v(8) = 0: ep(8) = 0
IF v(9) >= 0 THEN v(9) = 0: ep(9) = 0
IF v(10) >= 0 THEN v(10) = 0: ep(10) = 0
IF v(11) >= 0 THEN v(11) = 0: ep(11) = 0
IF v(12) >= 0 THEN v(12) = 0: ep(12) = 0

physix 3, 7
physix 3, 8
physix 3, 9
physix 3, 10
physix 3, 11
physix 3, 12

writetext xp%(7), 147, 3, 1, 8, 0, 319, 0, 199
writetext xp%(8), 147, 3, 9, 15, 0, 319, 0, 199
writetext xp%(9), 163, 4, 1, 7, 0, 319, 0, 199
LINE (xp%(9) + 113, 173)-(xp%(9) + 115, 173), 0
LINE (xp%(9) + 113, 174)-(xp%(9) + 115, 174), 0
LINE (xp%(9) + 113, 175)-(xp%(9) + 115, 175), 0
writetext xp%(10), 163, 4, 8, 8, 0, 319, 0, 199
writetext xp%(11), 163, 4, 9, 14, 0, 319, 0, 199
writetext xp%(12), 163, 4, 15, 20, 0, 319, 0, 199

IF vsync% = 1 THEN endcpumeter (63)
IF vsync% < 5 THEN WAIT &H3DA, 8: WAIT &H3DA, 8, 8
IF vsync% = 1 THEN startcpumeter

LOOP
endcpumeter (63)




delay 140

REM ------------- Fade out koutes ---------------


FOR i% = 127 TO 0 STEP -1

OUT &H3C8, 16
OUT &H3C9, i% \ 2
OUT &H3C9, i% \ 2
OUT &H3C9, i% \ 2

IF vsync% < 5 THEN WAIT &H3DA, 8: WAIT &H3DA, 8, 8

'IF INKEY$ = CHR$(27) THEN GOTO 314

NEXT i%

delay 70

REM --------------- Fade out Qdomination Logo -------------

fadefromcolor 32, 63, 256, 63, 63, 63

FOR i% = -64 TO 139
fsin1%(i%) = SIN(i% / 12) * 8
fsin2%(i%) = SIN(i% / 6) * 8
NEXT i%

delay 70

REM ------------------ 2 Effects -------------------


par% = 17
kpar% = 0
kkkpar% = 1
pppkar% = 64
xcp% = 321
yytp% = 1


DO WHILE kkpar% < 41

REM =================== Plasma effect =======================

IF ytp% < 76 THEN ytp% = ytp% + 1
IF ytp% < 62 THEN yttp% = ytp%
IF kkpar% > 26 THEN yytp% = yytp% + 1

k% = k% + 1
IF k% = 75 THEN k% = 0

yp% = 66 * 20

FOR y% = 1 TO yttp%
yp% = yp% + 20
DEF SEG = &HA000 + yp%

FOR x% = 1 TO 61

c% = fsin1%(x% + k%) + fsin1%(y% + k%) + fsin1%(x% + fsin2%(x% - y% + k%)) + fsin2%(y% + fsin1%(y% - x% + k%)) + 96
IF c% = 128 THEN c% = 127
IF y% + 1 > yytp% THEN POKE x% + 33, c% ELSE POKE x% + 33, 0

NEXT x%
NEXT y%

REM =================== Feedback effect =======================

REM ---------- Sprites, stars, generators -------------------
kp% = kp% + 1

xp% = SIN(kp% / 21) * 20 - 8
yp% = COS(kp% / 13) * 20 - 8
ap% = 31 + xp% + (31 + yp%) * 61

FOR y% = 1 TO 16
FOR x% = 1 TO 16
IF sp%(x%, y%) <> 0 THEN c%(ap% + x% + p61%(y%)) = sp%(x%, y%)
NEXT x%
NEXT y%

FOR i% = 1 TO 4
xx% = INT(RND * 56) + 4: yy% = INT(RND * 56) + 4
c%(xx% + p61%(yy%)) = 255
c%(xx% - 1 + p61%(yy%)) = 255
c%(xx% + 1 + p61%(yy%)) = 255
c%(xx% + p61%(yy% - 1)) = 255
c%(xx% + p61%(yy% + 1)) = 255
c%(xx% - 1 + p61%(yy% - 1)) = 255
c%(xx% + 1 + p61%(yy% + 1)) = 255
NEXT i%

REM ------------ Blur ----------------

vp% = 61
yp% = 1340
FOR y% = -30 TO 30
DEF SEG = &HA000 + yp%
yp% = yp% + 20

FOR x% = -30 TO 30
vp% = vp% + 1

c%(vp%) = div%(c%(vp% - 1) + c%(vp% + 1) + c%(vp% + 61) + c%(vp% - 61))
c%(vp% + 4000) = c%(vp%)
IF y% + 45 < ytp% AND y% + 32 > yytp% THEN POKE x% + 160, pdiv%(c%(vp%)) ELSE POKE x% + 160, 0

NEXT x%
NEXT y%


REM ----------- Zoom ------------------

vp% = 61

FOR y% = 30 TO -30 STEP -1
FOR x% = 30 TO -30 STEP -1
vp% = vp% + 1
c%(vp%) = c%(vp% + 4000 + fdiv%(x%) + pf61%(y%))

NEXT x%
NEXT y%



REM ------------- Koutes Dialegma ---------------

kpar% = kpar% + 1
IF kpar% >= pppkar% THEN kpar% = 0: par% = par% + 1: ppar% = par% - 1: IF par% = 20 THEN par% = 17: ppar% = 19: kkpar% = kkpar% + 1
IF kkpar% = 5 THEN pppkar% = 32

IF pppkar% = 64 THEN GOTO 46
IF kpar% = 0 THEN OUT &H3C8, 19: OUT &H3C9, 0: OUT &H3C9, 0: OUT &H3C9, 0: kkpar% = kkpar% + 1
IF kpar% = pppkar% - pppkar% / 2 THEN OUT &H3C8, 19: OUT &H3C9, 63: OUT &H3C9, 63: OUT &H3C9, 63
GOTO 47


46
IF kpar% = 0 THEN OUT &H3C8, par%: OUT &H3C9, 0: OUT &H3C9, 0: OUT &H3C9, 0
IF kpar% = 0 THEN OUT &H3C8, ppar%: OUT &H3C9, 63: OUT &H3C9, 63: OUT &H3C9, 63

47

aaa$ = INKEY$
IF aaa$ = CHR$(27) THEN GOTO 7447
IF aaa$ = " " THEN GOTO 303

IF cht% = 0 THEN GOTO 87

xcp% = xcp% - 1
writetext xcp%, 88, 7, 1, 7, 228, 284, 0, 199
IF xcp% = -112 THEN cht% = 0

87

IF vsync% = 1 THEN endcpumeter (63)
IF vsync% < 5 THEN WAIT &H3DA, 8: WAIT &H3DA, 8, 8
IF vsync% = 1 THEN startcpumeter


LOOP

endcpumeter (63)


REM -------------------- Closing the boxes ---------------------

delay 140

FOR i% = 0 TO 127

aaa$ = INKEY$
IF aaa$ = CHR$(27) THEN GOTO 7447
IF aaa$ = " " THEN GOTO 303

OUT &H3C8, 19
OUT &H3C9, i% \ 2
OUT &H3C9, i% \ 2
OUT &H3C9, i% \ 2
IF vsync% < 5 THEN WAIT &H3DA, 8: WAIT &H3DA, 8, 8
NEXT i%

delay 70

fadetocolor 32, 63, 256, 63, 63, 63

delay 70

xp% = 97: yp% = 65

k% = 32
FOR i% = 1 TO 32: c%(i%) = xp%: c%(i% + 500) = yp%: NEXT i%
FOR i% = 290 TO 322: c%(i%) = xp%: c%(i% + 500) = yp%: NEXT i%


DO WHILE k% < 322

aaa$ = INKEY$
IF aaa$ = CHR$(27) THEN GOTO 7447
IF aaa$ = " " THEN GOTO 303

k% = k% + 1

SELECT CASE k%

CASE IS < 98
xp% = xp% - 1
c%(k%) = xp%
c%(k% + 500) = yp%

CASE IS < 162
yp% = yp% + 1
c%(k%) = xp%
c%(k% + 500) = yp%

CASE IS < 226
xp% = xp% + 1
c%(k%) = xp%
c%(k% + 500) = yp%

CASE IS < 290
yp% = yp% - 1
c%(k%) = xp%
c%(k% + 500) = yp%

CASE IS < 322

CASE ELSE

END SELECT

DEF SEG = &HA000 + c%(k% + 500) * 20
POKE c%(k%), 0
DEF SEG = &HA000 + c%(k% + 500 - 16) * 20
POKE c%(k% - 16) + 96, 0
DEF SEG = &HA000 + c%(k% + 500 - 32) * 20
POKE c%(k% - 32) + 192, 0

IF vsync% < 5 THEN WAIT &H3DA, 8: WAIT &H3DA, 8, 8
LOOP

delay 140


REM ------------------ Gramata pano fevgoun --------------------

v(1) = .07
ep(1) = -.07

v(2) = .06
ep(2) = -.06

v(3) = .05
ep(3) = -.05

v(4) = .04
ep(4) = -.04

v(5) = .03
ep(5) = -.03

v(6) = .02
ep(6) = -.02

DO WHILE xp%(6) > -180

aaa$ = INKEY$
IF aaa$ = CHR$(27) THEN GOTO 7447
IF aaa$ = " " THEN GOTO 303

physix 3, 1
physix 3, 2
physix 3, 3
physix 3, 4
physix 3, 5
physix 3, 6

writetext xp%(1), 16, 1, 1, 7, 0, 319, 0, 199
writetext xp%(2), 16, 1, 8, 11, 0, 319, 0, 199
LINE (xp%(2) + 64, 16)-(xp%(2) + 69, 32), 0, BF
writetext xp%(3), 16, 1, 12, 12, 0, 319, 0, 199
LINE (xp%(3) + 16, 22)-(xp%(3) + 20, 26), 0, BF
writetext xp%(4), 16, 1, 13, 17, 0, 319, 0, 199
writetext xp%(5), 32, 2, 1, 6, 0, 319, 0, 199
writetext xp%(6), 32, 2, 7, 17, 0, 319, 0, 199

IF vsync% = 1 THEN endcpumeter (63)
IF vsync% < 5 THEN WAIT &H3DA, 8: WAIT &H3DA, 8, 8
IF vsync% = 1 THEN startcpumeter

LOOP
endcpumeter (63)

delay 140


REM ------------------ Gramata kato fevgoun --------------------

v(7) = .07
ep(7) = -.07

v(8) = .06
ep(8) = -.06

v(9) = .05
ep(9) = -.05

v(10) = .04
ep(10) = -.04

v(11) = .03
ep(11) = -.03

v(12) = .02
ep(12) = -.02


DO WHILE xp%(12) > -180

aaa$ = INKEY$
IF aaa$ = CHR$(27) THEN GOTO 7447
IF aaa$ = " " THEN GOTO 303

physix 3, 7
physix 3, 8
physix 3, 9
physix 3, 10
physix 3, 11
physix 3, 12

writetext xp%(7), 147, 3, 1, 8, 0, 319, 0, 199
writetext xp%(8), 147, 3, 9, 15, 0, 319, 0, 199
writetext xp%(9), 163, 4, 1, 7, 0, 319, 0, 199
LINE (xp%(9) + 113, 167)-(xp%(9) + 117, 179), 0, BF
writetext xp%(10), 163, 4, 8, 8, 0, 319, 0, 199
writetext xp%(11), 163, 4, 9, 14, 0, 319, 0, 199
writetext xp%(12), 163, 4, 15, 20, 0, 319, 0, 199

IF vsync% = 1 THEN endcpumeter (63)
IF vsync% < 5 THEN WAIT &H3DA, 8: WAIT &H3DA, 8, 8
IF vsync% = 1 THEN startcpumeter

LOOP
endcpumeter (63)

delay 140


REM --------------- Lines Fevgoun ---------------------

xp%(1) = 320
x(1) = 320
v(1) = .02
ep(1) = -.02

DO WHILE xp%(1) >= -450

aaa$ = INKEY$
IF aaa$ = CHR$(27) THEN GOTO 7447
IF aaa$ = " " THEN GOTO 303

physix 3, 1

LINE (xp%(1), 12)-(xp%(1) + 3, 12), 0
LINE (xp%(1), 142)-(xp%(1) + 3, 142), 0

LINE (320 - xp%(1), 52)-(317 - xp%(1), 52), 0
LINE (320 - xp%(1), 182)-(317 - xp%(1), 182), 0

IF vsync% < 5 THEN WAIT &H3DA, 8: WAIT &H3DA, 8, 8

LOOP


CLS

FOR i% = 1 TO 16
ci% = (i% - 16) * 4.2
ri% = ci%
gi% = ci%
bi% = ci%
OUT &H3C8, i%
OUT &H3C9, ri%
OUT &H3C9, gi%
OUT &H3C9, bi%
NEXT i%

FOR i% = 17 TO 255
OUT &H3C8, i%
OUT &H3C9, 0
OUT &H3C9, 0
OUT &H3C9, 0
NEXT i%


73313

303 palget
fadetocolor 0, 255, 63, 0, 0, 0

' Damn!

FOR i% = 0 TO 32000
c%(i%) = 0
NEXT i%

REM ============= After the Elite ==============

FOR i% = -160 TO 159
fsin2%(i%) = i% + 159
NEXT i%
FOR i% = -24 TO 24
fsin3%(i%) = (i% + 24) * 320
NEXT i%

FOR i% = 0 TO 512
div%(i%) = i% \ 2
NEXT i%

CLS

FOR i% = 127 TO 1 STEP -1
OUT &H3C8, 0
OUT &H3C9, i% \ 2
OUT &H3C9, i% \ 2
OUT &H3C9, i% \ 2
IF vsync% < 5 THEN WAIT &H3DA, 8: WAIT &H3DA, 8, 8
NEXT i%


REM ============= INTRO 2  ==============


FOR i% = -160 TO 159
fsin2%(i%) = i% + 160
NEXT i%
FOR i% = -24 TO 24
fsin3%(i%) = (i% + 24) * 320
NEXT i%

xp%(1) = 4: xp%(2) = 7: xp%(3) = 0: xp%(4) = 3: xp%(5) = 6: xp%(6) = 0: xp%(7) = 3: xp%(8) = 6
kat%(1) = 1: kat%(2) = 1: kat%(3) = 2: kat%(4) = 2: kat%(5) = 2: kat%(6) = 3: kat%(7) = 3: kat%(8) = 3
FOR i% = 1 TO 7: v(i%) = 1: NEXT i%
v(8) = .1

kkf% = 0


a = 0: c = 255: t = 100: r = 0: g = 0: b = 0

DO WHILE kkf% < 8

kkf% = kkf% + 1



FOR i% = 1 TO 16
ci% = (i% - 16) * 4.2
ri% = ci%
gi% = ci%
bi% = ci%
OUT &H3C8, i%
OUT &H3C9, ri%
OUT &H3C9, gi%
OUT &H3C9, bi%
NEXT i%

FOR i% = 17 TO 255
OUT &H3C8, i%
OUT &H3C9, 0
OUT &H3C9, 0
OUT &H3C9, 0
NEXT i%

IF kkf% = 8 THEN palget



preparewriter kat%(kkf%)
k% = xp%(kkf%)

text2array 1 + k%, 0
text2array 2 + k%, 1
text2array 3 + k%, 2

zf = 64

DO WHILE zf > v(kkf%)

aaa$ = INKEY$
IF aaa$ = CHR$(27) THEN GOTO 7447
IF aaa$ = " " THEN GOTO 304

IF kkf% < 8 THEN GOTO 931
IF zf > 2 THEN GOTO 931

IF s < t THEN s = s + 1

FOR k = a TO c
OUT &H3C8, k
OUT &H3C9, r(k) + s * ((r - r(k)) / t)
OUT &H3C9, g(k) + s * ((g - g(k)) / t)
OUT &H3C9, b(k) + s * ((b - b(k)) / t)
NEXT k

931

zf = zf / 1.02
'zf = 1

zoomebaby zf

IF vsync% = 1 THEN endcpumeter (0)
IF vsync% < 5 THEN WAIT &H3DA, 8: WAIT &H3DA, 8, 8
IF vsync% = 1 THEN startcpumeter

LOOP

IF vsync% = 1 THEN endcpumeter (0)


IF kkf% < 8 THEN blurtext
IF patith% = 27 THEN GOTO 7447
IF patith% = 1 THEN GOTO 304
CLS

LOOP

304 IF vsync% = 1 THEN endcpumeter (0)
palget
fadetocolor 0, 255, 63, 0, 0, 0

CLS

REM =================== Plasma 1 ========================

pallete 1
sines 1


k1% = 0: mk% = 0
xp% = 60
prevy% = yp%: nextp% = yp%

fps% = 0
v = -6.3
t = 0
f = 1
y = 500
yp% = 500

DO WHILE fps% < 600

aaa$ = INKEY$
IF aaa$ = CHR$(27) THEN GOTO 7447
IF aaa$ = " " THEN GOTO 305

fps% = fps% + 1

physix2

nexty% = yp%

kkk% = kkk% + 1

plasmas 1, 200, 130, xp%, yp%

prevy% = nexty%

IF yp% <= 70 THEN blackbox 60, nexty% + 132, 260, prevy% + 134
IF vsync% = 1 THEN endcpumeter (0)
IF vsync% < 5 THEN WAIT &H3DA, 8: WAIT &H3DA, 8, 8
IF vsync% = 1 THEN startcpumeter
IF yp% >= 0 THEN blackbox 60, prevy% - 2, 260, nexty%

LOOP

305 IF vsync% = 1 THEN endcpumeter (0)
palget
fadetocolor 0, 255, 63, 0, 0, 0
CLS


REM =================== Plasma 2 ========================


pallete 2
sines 3


k1% = 0: mk% = 0
xp% = 0: yp% = 0

lxp% = 319: lyp% = 0
fps% = 0
DO WHILE fps% < 1001

aaa$ = INKEY$
IF aaa$ = CHR$(27) THEN GOTO 7447
IF aaa$ = " " THEN GOTO 306

fps% = fps% + 1
IF fps% < 200 THEN lyp% = lyp% + 1
IF fps% > 800 THEN lyp% = lyp% - 1: LINE (0, lyp% - 2)-(319, lyp% + 1), 0, BF


plasmas 3, lxp%, lyp%, xp%, yp%

IF vsync% = 1 THEN endcpumeter (0)
IF vsync% < 4 THEN WAIT &H3DA, 8: WAIT &H3DA, 8, 8
IF vsync% = 1 THEN startcpumeter

LOOP

306 IF vsync% = 1 THEN endcpumeter (0)
palget
fadetocolor 0, 255, 63, 0, 0, 0
CLS



REM =================== Plasma 3 ========================


pallete 4
sines 4

yp% = 320

k1% = 0: mk% = 0
xp% = 0: yp% = 0

lxp% = 319: lyp% = 0
fps% = 0
DO WHILE fps% < 801

aaa$ = INKEY$
IF aaa$ = CHR$(27) THEN GOTO 7447
IF aaa$ = " " THEN GOTO 307

fps% = fps% + 1
IF fps% < 300 AND lyp% < 320 THEN lyp% = lyp% + 1
IF fps% > 500 THEN lyp% = lyp% - 1: LINE (0, lyp% - 2)-(319, lyp% + 1), 0, BF


plasmas 4, lxp%, lyp%, xp%, yp%


IF vsync% = 1 THEN endcpumeter (0)
IF vsync% < 4 THEN WAIT &H3DA, 8: WAIT &H3DA, 8, 8
IF vsync% = 1 THEN startcpumeter

LOOP

307 IF vsync% = 1 THEN endcpumeter (0)
palget
fadetocolor 0, 255, 63, 0, 0, 0
CLS


' ---------- Image taken -------------

p$ = "draculin.pal": f$ = "draculin.spr"
pal0 p$
xg% = 160: yg% = 200
DIM SHARED cs%(xg%, yg%)
img0 f$

palget

' --------- Proetimasia gia rotozoomer ---------


FOR i% = -1024 TO 1024
fsin1%(i%) = i% \ 512
NEXT i%

FOR i% = -1024 TO -1
fsin2%(i%) = i% - ((i% - xg% + 1) \ xg%) * xg%
fsin3%(i%) = i% - ((i% - yg% + 1) \ yg%) * yg%
NEXT i%

FOR i% = 0 TO 1024
fsin2%(i%) = i% - ((i% - 1) \ xg%) * xg%
fsin3%(i%) = i% - ((i% - 1) \ yg%) * yg%
NEXT i%


a = 0: c = 255: t = 100: r = 0: g = 0: b = 0: s = 0

' -------------- Rotozoomer -----------------

xl% = 320: yl% = 200
k1% = 0
angle% = 35

fps% = 0
DO WHILE fps% < 800

aaa$ = INKEY$
IF aaa$ = CHR$(27) THEN GOTO 7447
IF aaa$ = " " THEN GOTO 308

fps% = fps% + 1
k1% = k1% + 1
zf% = COS(k1% / 64) * 128 + SIN(k1% / 24) * 256 + 432

IF fps% > 100 THEN GOTO 101

IF s < t THEN s = s + 1

FOR k = a TO c
OUT &H3C8, k
OUT &H3C9, r + s * ((r(k) - r) / t)
OUT &H3C9, g + s * ((g(k) - g) / t)
OUT &H3C9, b + s * ((b(k) - b) / t)
NEXT k

101 IF fps% = 101 THEN a = 0: c = 255: t = 100: r = 63: g = 63: b = 63: s = 0

rotozoom angle%, zf%, xl%, yl%

IF fps% < 701 THEN GOTO 700

IF s < t THEN s = s + 1

FOR k = a TO c
OUT &H3C8, k
OUT &H3C9, r(k) + s * ((r - r(k)) / t)
OUT &H3C9, g(k) + s * ((g - g(k)) / t)
OUT &H3C9, b(k) + s * ((b - b(k)) / t)
NEXT k


700
LOOP

308 IF vsync% = 1 THEN endcpumeter (0)
palget
fadetocolor 0, 255, 63, 0, 0, 0
CLS


707

LINE (0, 0)-(319, 199), 0, BF
FOR i% = 63 TO 0 STEP -1
OUT &H3C8, 0
OUT &H3C9, i%
OUT &H3C9, i%
OUT &H3C9, i%
IF vsync% < 5 THEN WAIT &H3DA, 8: WAIT &H3DA, 8, 8
NEXT i%


REM ---------------- Fire -------------------



FOR i% = 0 TO 640
fsin1%(i%) = INT(RND * 192) + 63
NEXT i%



FOR i% = 0 TO 1024
div%(i%) = i% / 4 - INT(RND * 4.7)
IF div%(i%) < 0 THEN div%(i%) = 0
NEXT i%

xg% = 28800
DIM cp%(xg%)

REM ---------- Calculating the pallete ----------

FOR k% = 0 TO 63

OUT &H3C8, k%
OUT &H3C9, k%
OUT &H3C9, 0
OUT &H3C9, 0

NEXT k%


FOR k% = 64 TO 127

OUT &H3C8, k%
OUT &H3C9, 63
OUT &H3C9, (k% - 64) \ 2
OUT &H3C9, 0

NEXT k%

FOR k% = 128 TO 191

OUT &H3C8, k%
OUT &H3C9, 63
OUT &H3C9, 32 + (k% - 128) \ 2
OUT &H3C9, 0

NEXT k%

FOR k% = 192 TO 255

OUT &H3C8, k%
OUT &H3C9, 63
OUT &H3C9, 63
OUT &H3C9, k% - 192

NEXT k%


PAINT (1, 1), 0


FOR i% = 0 TO 28800
cp%(i%) = 0
NEXT i%

COLOR 43


REM --------- Fire status ----------


REM ----------------------------------------------------
REM ------------ Calculating the fire ------------------
REM ----------------------------------------------------

fps% = 0

DO WHILE fps% < 600

aaa$ = INKEY$
IF aaa$ = CHR$(27) THEN GOTO 7447
IF aaa$ = " " THEN GOTO 309

fps% = fps% + 1

vrp% = -2

i% = 0
yp% = 0
FOR y% = 3 TO 179
DEF SEG = &HA000 + 560 + yp%
yp% = yp% + 20

FOR x% = 1 TO 160
i% = i% + 1
cp%(i%) = div%(cp%(i% + 160) + cp%(i% + 319) + cp%(i% + 320) + cp%(i% + 321))
POKE x% + 320, cp%(i%): POKE x% + 160, cp%(i%)


NEXT x%
NEXT y%

IF vsync% = 1 THEN endcpumeter (0)
IF vsync% < 5 THEN WAIT &H3DA, 8: WAIT &H3DA, 8, 8
IF vsync% = 1 THEN startcpumeter: GOTO 133
IF vsync% < 4 THEN WAIT &H3DA, 8: WAIT &H3DA, 8, 8
133

REM -------- The base -----------

rd1% = INT(RND * 160)
rd2% = INT(RND * 160)
rd3% = INT(RND * 160)

kkk% = 0
FOR i% = 28000 TO 28160
kkk% = kkk% + 1
IF fps% < 450 THEN cp%(i%) = fsin1%(rd1% + kkk%) ELSE cp%(i%) = 0
IF fps% < 450 THEN cp%(i% + 160) = fsin1%(rd1% + kkk%) ELSE cp%(i%) = 0
NEXT i%

LOOP

309 IF vsync% = 1 THEN endcpumeter (0)
palget
fadetocolor 0, 255, 63, 0, 0, 0
CLS


REM ------------- Plasma plasma -------------------

pallete 2
sines 2


xp% = 159: yp% = 99: lxp% = 2: lyp% = 2
mk% = 0: k1% = 0

fps% = 0
DO WHILE fps% < 1000

aaa$ = INKEY$
IF aaa$ = CHR$(27) THEN GOTO 7447
IF aaa$ = " " THEN GOTO 310


fps% = fps% + 1
IF fps% < 128 THEN lxp% = lxp% + 2: xp% = xp% - 1
IF fps% > 127 AND fps% < 215 THEN lyp% = lyp% + 2: yp% = yp% - 1
IF fps% > 600 AND xp% <> 159 THEN lxp% = lxp% - 2: xp% = xp% + 1: LINE (xp% - 1, yp% + 1)-(xp% - 1, yp% + lyp% + 1), 0: LINE (xp% + lxp% + 1, yp% + 1)-(xp% + lxp% + 1, yp% + lyp% + 1), 0
IF fps% > 759 AND yp% <> 99 THEN lyp% = lyp% - 2: yp% = yp% + 1: LINE (xp%, yp%)-(xp% + 2, yp%), 0: LINE (xp%, yp% + lyp% + 2)-(xp% + 2, yp% + lyp% + 2), 0
plasmas 2, lxp%, lyp%, xp%, yp%

IF vsync% = 1 THEN endcpumeter (0)
IF vsync% < 4 THEN WAIT &H3DA, 8: WAIT &H3DA, 8, 8
IF vsync% = 1 THEN startcpumeter

LOOP

310 IF vsync% = 1 THEN endcpumeter (0)
palget
fadetocolor 0, 255, 63, 0, 0, 0
CLS


317337


REM ================= Feedback ======================


preparewriter 2
k% = 0

text2array 1 + k%, 0
text2array 2 + k%, 1
text2array 3 + k%, 2





OUT &H3D4, 9
OUT &H3D5, 3

xg% = 32000
DIM c2%(xg%)


FOR i% = -1024 TO 1024
fsin1%(i%) = SIN(i% / 35) * 10
fsin2%(i%) = COS(i% / 21) * 10
fsin3%(i%) = SIN(i% / 7) * 10
NEXT i%



FOR i% = -100 TO 100
ay1%(i%) = i% * 320
NEXT i%

FOR i% = -159 TO 160
ax1%(i%) = i% / 7
NEXT i%

FOR i% = -49 TO 49
ay2%(i%) = ay1%(ax1%(i%))
NEXT i%

FOR i% = 0 TO 1024
div%(i%) = i% \ 4 - 3
IF div%(i%) < 0 THEN div%(i%) = 0
NEXT i%

FOR i% = 0 TO 255
OUT &H3C8, i%
OUT &H3C9, i% \ 4
OUT &H3C9, i% \ 4
OUT &H3C9, i% \ 4
NEXT i%

COLOR 255
LOCATE 1, 1: PRINT "*"
FOR y% = 1 TO 8
FOR x% = 1 TO 8
sp%(x%, y%) = POINT(x% - 1, y% - 1)
NEXT x%
NEXT y%

CLS

FOR y% = 1 TO 16
FOR x% = 1 TO 16
PSET (x%, y%), sp%(x% \ 2, y% \ 2)
NEXT x%
NEXT y%

FOR y% = 1 TO 16
FOR x% = 1 TO 16
sp%(x%, y%) = POINT(x%, y%)
NEXT x%
NEXT y%


k% = 0
kk% = 1
fk% = -256


FOR i% = 1 TO 4
die1%(i%) = INT(RND * 20 + 10)
die2%(i%) = INT(RND * 20 + 10)
epe1%(i%) = INT(RND * 40 + 40)
epe2%(i%) = INT(RND * 20 + 20)
NEXT i%

k% = 0
DO WHILE k% < 800

aaa$ = INKEY$
IF aaa$ = CHR$(27) THEN GOTO 7447
IF aaa$ = " " THEN GOTO 311

k% = k% + 1


REM ---------- Sprites, stars, generators -------------------


FOR i% = 1 TO 4
xp%(i%) = SIN(k% / die1%(i%)) * epe1%(i%) + 152
yp%(i%) = COS(k% / die2%(i%)) * epe2%(i%) + 42
NEXT i%


FOR i% = 1 TO 4
ap% = xp%(i%) + ay1%(yp%(i%))

FOR y% = 1 TO 16
FOR x% = 1 TO 16
IF sp%(x%, y%) <> 0 THEN c%(ap% + x% + ay1%(y%)) = sp%(x%, y%)
NEXT x%
NEXT y%
NEXT i%

FOR i% = 1 TO 10
xx% = INT(RND * 312) + 4: yy% = INT(RND * 92) + 4
c%(xx% + ay1%(yy%)) = 255
c%(xx% - 1 + ay1%(yy%)) = 255
c%(xx% + 1 + ay1%(yy%)) = 255
c%(xx% + ay1%(yy% - 1)) = 255
c%(xx% - 1 + ay1%(yy% - 1)) = 255
c%(xx% + 1 + ay1%(yy% - 1)) = 255
NEXT i%

fk% = fk% + kk%
IF fk% = 256 OR fk% = -256 THEN kk% = -kk%

FOR x% = 0 TO 319

ys% = fsin1%(x% + 2 * fk%) + fsin2%(x% - 2 * fk%) + fsin3%(x% + fk%) + 50

c%(x% + ay1%(ys%)) = 255
c%(x% + ay1%(ys% + 1)) = 255
c%(x% - 1 + ay1%(ys%)) = 255


NEXT x%


10



REM ------------ Blur ----------------

DEF SEG = &HA000

FOR i% = 320 TO 31680

c%(i%) = div%(c%(i% - 1) + c%(i% + 1) + c%(i% + 320) + c%(i% - 320))
c2%(i%) = c%(i%)
POKE i%, c%(i%)

NEXT i%


REM ----------- Zoom ------------------


vp% = 0
FOR y% = 49 TO -49 STEP -1
FOR x% = 160 TO -159 STEP -1
c%(vp%) = c2%(vp% + ax1%(x%) + ay2%(y%))
vp% = vp% + 1

NEXT x%
NEXT y%

IF vsync% = 1 THEN endcpumeter (0)
IF vsync% < 3 THEN WAIT &H3DA, 8: WAIT &H3DA, 8, 8
IF vsync% = 1 THEN startcpumeter

LOOP

311 IF vsync% = 1 THEN endcpumeter (0)
palget
fadetocolor 0, 255, 63, 0, 0, 0

CLS




REM ============== Da Faqing Layers ================

OUT &H3D4, 9
OUT &H3D5, 1


p$ = "optimus.pal": f$ = "optimus0.spr"
pal0 p$
xg% = 80: yg% = 100
REDIM cs%(xg%, yg%)
img0 f$

palget

FOR k% = 0 TO 63
OUT &H3C8, k% + 127
OUT &H3C9, r(k%)
OUT &H3C9, g(k%)
OUT &H3C9, b(k%)
NEXT k%


FOR y% = 0 TO yg%
FOR x% = 0 TO xg%
cs%(x%, y%) = cs%(x%, y%) + 127
IF cs%(x%, y%) = 127 OR cs%(x%, y%) = 128 THEN cs%(x%, y%) = 0
NEXT x%
NEXT y%



' --------- Proetimasia gia rotozoomer ---------

FOR i% = -1024 TO 1024
fsin1%(i%) = i% \ 512
NEXT i%

FOR i% = -1024 TO -1
fsin2%(i%) = i% - ((i% - xg% + 1) \ xg%) * xg%
fsin3%(i%) = i% - ((i% - yg% + 1) \ yg%) * yg%
NEXT i%

FOR i% = 0 TO 1024
fsin2%(i%) = i% - ((i% - 1) \ xg%) * xg%
fsin3%(i%) = i% - ((i% - 1) \ yg%) * yg%
NEXT i%



r% = SQR(xg% ^ 2 + yg% ^ 2)
xw% = 120
yw% = 75
sc% = 1

xgg% = xg% \ 2
ygg% = yg% \ 2

ax = TIMER
k% = 0


FOR i% = 0 TO 31

OUT &H3C8, i%
OUT &H3C9, i% * 2
OUT &H3C9, i%
OUT &H3C9, 0

NEXT i%

FOR i% = 32 TO 63

OUT &H3C8, i%
OUT &H3C9, (63 - i%) * 2
OUT &H3C9, 63 - i%
OUT &H3C9, 0

NEXT i%



FOR i% = 64 TO 95

OUT &H3C8, i%
OUT &H3C9, 0
OUT &H3C9, i% - 64
OUT &H3C9, (i% - 64) * 2

NEXT i%

FOR i% = 96 TO 127

OUT &H3C8, i%
OUT &H3C9, 0
OUT &H3C9, 127 - i%
OUT &H3C9, (127 - i%) * 2

NEXT i%


FOR i% = 192 TO 196
OUT &H3C8, i%
OUT &H3C9, (i% - 192) * 15
OUT &H3C9, 0
OUT &H3C9, 0
NEXT i%

FOR i% = 197 TO 201
OUT &H3C8, i%
OUT &H3C9, (201 - i%) * 15
OUT &H3C9, 0
OUT &H3C9, 0
NEXT i%


FOR i% = 216 TO 220
OUT &H3C8, i%
OUT &H3C9, 0
OUT &H3C9, (i% - 216) * 15
OUT &H3C9, 0
NEXT i%

FOR i% = 221 TO 225
OUT &H3C8, i%
OUT &H3C9, 0
OUT &H3C9, (225 - i%) * 15
OUT &H3C9, 0
NEXT i%


FOR i% = 232 TO 236
OUT &H3C8, i%
OUT &H3C9, (i% - 232) * 15
OUT &H3C9, (i% - 232) * 7
OUT &H3C9, 0
NEXT i%

FOR i% = 237 TO 241
OUT &H3C8, i%
OUT &H3C9, (241 - i%) * 15
OUT &H3C9, (241 - i%) * 7
OUT &H3C9, 0
NEXT i%


FOR i% = 244 TO 248
OUT &H3C8, i%
OUT &H3C9, (i% - 244) * 15
OUT &H3C9, 0
OUT &H3C9, (i% - 244) * 15
NEXT i%

FOR i% = 249 TO 253
OUT &H3C8, i%
OUT &H3C9, (253 - i%) * 15
OUT &H3C9, 0
OUT &H3C9, (253 - i%) * 15
NEXT i%



DIM cv1%(-1000 TO 1000)
DIM cv2%(-1000 TO 1000)
DIM cv3%(-1000 TO 1000)

FOR i% = -1000 TO -1
cv% = i% - ((i% - 255) \ 256) * 256
IF cv% > 63 THEN cv1%(i%) = 0 ELSE cv1%(i%) = cv%
IF cv% > 127 OR cv% < 64 THEN cv2%(i%) = 0 ELSE cv2%(i%) = cv%
IF cv% < 192 THEN cv3%(i%) = 0 ELSE cv3%(i%) = cv%

NEXT i%

FOR i% = 0 TO 1000
cv% = i% - (i% \ 256) * 256
IF cv% > 63 THEN cv1%(i%) = 0 ELSE cv1%(i%) = cv%
IF cv% > 127 OR cv% < 64 THEN cv2%(i%) = 0 ELSE cv2%(i%) = cv%
IF cv% < 192 THEN cv3%(i%) = 0 ELSE cv3%(i%) = cv%

NEXT i%



DIM bsin1%(-1024 TO 1024)
DIM bsin2%(-1024 TO 1024)
DIM bsin3%(-1024 TO 1024)

FOR i% = -1024 TO 1024

bsin1%(i%) = SIN(i% / 25) * 16
bsin2%(i%) = SIN(i% / 15) * 32
bsin3%(i%) = SIN(i% / 35) * 48

NEXT i%


k% = -800
k2% = -800
k3% = -800

fps% = 0
DO WHILE fps% < 500

aaa$ = INKEY$
IF aaa$ = CHR$(27) OR aaa$ = " " THEN GOTO 7447
fps% = fps% + 1

k% = k% + 1
k2% = k2% + 2
k3% = k3% + 3

zf% = 256 * COS(k% / 35) + 290

fcos% = COS(k% / 24) * 64
fsin% = SIN(k% / 24) * 64


ay1% = (-r% \ 2) * fsin%
ay2% = (-r% \ 2) * fcos%

ax1% = (-r% \ 2) * fcos%
ax2% = (-r% \ 2) * fsin%
axx1% = ax1%
axx2% = ax2%


FOR y% = 0 TO 199
DEF SEG = &HA000 + y% * 20

ay1% = ay1% + fsin%
ay2% = ay2% + fcos%

ax1% = axx1%
ax2% = axx2%


FOR x% = 0 TO 319

c% = cv1%(bsin1%(x% + k2%) + bsin2%(y% - k3% - bsin1%(x% - y% + k%)))
IF c% = 0 THEN c% = bsin1%(y%) + bsin2%(x% + y%) - bsin3%(x% - y% + k3%): c% = cv2%(2 * c%)

ax1% = ax1% + fcos%
ax2% = ax2% + fsin%

IF c% = 0 THEN xt% = (ax1% - ay1%) \ zf% + xgg%: yt% = (ax2% + ay2%) \ zf% + ygg%: xt% = fsin2%(xt%): yt% = fsin3%(yt%): c% = cs%(xt%, yt%)

IF c% = 0 THEN c% = bsin1%(x% + k2%) - bsin2%(y%) - bsin3%(x% + y%) + bsin1%(bsin2%(x% + k%) - bsin3%(y% + k2%) + bsin1%(x% - y% + k3%)) \ 4: c% = cv3%(c%)

POKE x%, c%

NEXT x%
NEXT y%

IF vsync% = 1 THEN endcpumeter (0)
IF vsync% < 2 THEN WAIT &H3DA, 8: WAIT &H3DA, 8, 8
IF vsync% = 1 THEN startcpumeter

LOOP


7447
IF vsync% = 1 THEN endcpumeter (0)
palget
fadetocolor 0, 255, 63, 0, 0, 0

SCREEN 12
SCREEN 0

PRINT "It's over!"
PRINT "----------"

PRINT
PRINT "Into the Fight, a pure Qbasic demo by Michael Kargas aka Optimus/Dirty Minds/the Lab or mkargas@hotmail.com or http://www.fortunecity.com/skyscraper/black/791"
PRINT
PRINT
PRINT "0. Quit to Dos"
PRINT "1. Run the Note!"
PRINT
391 LOCATE 11, 1: INPUT "Choose your Destiny", answ%

IF answ% = 0 THEN END
IF answ% < 0 OR answ% > 1 THEN GOTO 391
IF answ% = 1 THEN SHELL "itfnote.exe"

END
'The World is Over..

SUB blackbox (x1%, y1%, x2%, y2%)

yp% = y1% * 20

FOR y% = y1% TO y2%
DEF SEG = &HA000 + yp%
yp% = yp% + 20

FOR x% = x1% TO x2%

POKE x%, 0

NEXT x%
NEXT y%


END SUB

SUB blurtext

SHARED vsync%, patith%

delay 280

REM ============== Skatobalwma 17 ==================

FOR y% = 0 TO 78
DEF SEG = &HA000 + y% * 20
FOR x% = 0 TO 319
POKE x%, 0
NEXT x%
NEXT y%

FOR y% = 125 TO 319
DEF SEG = &HA000 + y% * 20
FOR x% = 0 TO 319
POKE x%, 0
NEXT x%
NEXT y%

REM ===================== Teliose ========================


FOR i% = 16 TO 255
OUT &H3C8, i%
OUT &H3C9, i% \ 4
OUT &H3C9, i% \ 4
OUT &H3C9, i% \ 4
NEXT i%

FOR y% = 77 TO 126
DEF SEG = &HA000 + y% * 20
FOR x% = 0 TO 319
c%(kf%) = POINT(x%, y%) * 16
POKE x%, c%(kf%)
kf% = kf% + 1
NEXT x%
NEXT y%

FOR i% = 0 TO 15
OUT &H3C8, i%
OUT &H3C9, i% \ 4
OUT &H3C9, i% \ 4
OUT &H3C9, i% \ 4
NEXT i%

fps% = 0
DO WHILE fps% < 256
fps% = fps% + 1

aaa$ = INKEY$
IF aaa$ = CHR$(27) THEN patith% = 27: GOTO 7448
IF aaa$ = " " THEN patith% = 1: GOTO 7448

DEF SEG = &HA000 + 77 * 20
FOR kf% = 320 TO 16320

c%(kf%) = div%(c%(kf% - 1) + c%(kf% + 1))
POKE kf%, c%(kf%)

NEXT kf%

IF vsync% = 1 THEN endcpumeter (0)
IF vsync% < 5 THEN WAIT &H3DA, 8: WAIT &H3DA, 8, 8
IF vsync% = 1 THEN startcpumeter
LOOP

7448
IF vsync% = 1 THEN endcpumeter (0)

END SUB

SUB delay (a%)

SHARED vsync%

FOR ii% = 1 TO a%
IF vsync% < 5 THEN WAIT &H3DA, 8: WAIT &H3DA, 8, 8
NEXT ii%

END SUB

SUB endcpumeter (bgc%)

OUT &H3C8, 0
OUT &H3C9, bgc%
OUT &H3C9, bgc%
OUT &H3C9, bgc%

END SUB

SUB fadefromcolor (a, c, t, r, g, b)

SHARED vsync%

FOR s = 1 TO t

FOR k = a TO c
OUT &H3C8, k
OUT &H3C9, r + s * ((r(k) - r) / t)
OUT &H3C9, g + s * ((g(k) - g) / t)
OUT &H3C9, b + s * ((b(k) - b) / t)
NEXT k

IF vsync% < 5 THEN WAIT &H3DA, 8: WAIT &H3DA, 8, 8
NEXT s


END SUB

SUB fadetocolor (a, c, t, r, g, b)

SHARED vsync%

FOR s = 1 TO t
FOR k = a TO c
OUT &H3C8, k
OUT &H3C9, r(k) + s * ((r - r(k)) / t)
OUT &H3C9, g(k) + s * ((g - g(k)) / t)
OUT &H3C9, b(k) + s * ((b - b(k)) / t)
NEXT k

IF vsync% < 5 THEN WAIT &H3DA, 8: WAIT &H3DA, 8, 8

NEXT s


END SUB

SUB fadetocolorscale (a, c, t, r, g, b)

SHARED vsync%

FOR s = 1 TO t
FOR k = a TO c
mo = (r(k) \ 1.5 + g(k) + b(k) \ 2) \ 2.16
OUT &H3C8, k
OUT &H3C9, r(k) + s * (((r * mo) \ 63 - r(k)) / t)
OUT &H3C9, g(k) + s * (((g * mo) \ 63 - g(k)) / t)
OUT &H3C9, b(k) + s * (((b * mo) \ 63 - b(k)) / t)
NEXT k

IF vsync% < 5 THEN WAIT &H3DA, 8: WAIT &H3DA, 8, 8

NEXT s


END SUB

SUB img0 (f$)

a$ = " "
p% = 0

OPEN f$ FOR BINARY AS #1
GET #1, 1, a$
xg% = ASC(a$)
GET #1, 2, a$
yg% = ASC(a$)

FOR y% = 1 TO yg%
FOR x% = 1 TO xg%
p% = p% + 1
GET #1, p% + 2, a$
cs%(x%, y%) = ASC(a$)
NEXT x%
NEXT y%
CLOSE



END SUB

SUB pal0 (a$)

DIM ri%(255), gi%(255), bi%(255)

r$ = " ": g$ = " ": b$ = " "


OPEN a$ FOR BINARY AS #1

FOR k% = 0 TO 255

GET #1, 1 + l%, r$
ri%(k%) = ASC(r$)
GET #1, 2 + l%, g$
gi%(k%) = ASC(g$)
GET #1, 3 + l%, b$
bi%(k%) = ASC(b$)
l% = l% + 3
NEXT k%
CLOSE

FOR k% = 0 TO 255

OUT &H3C8, k%
OUT &H3C9, ri%(k%)
OUT &H3C9, gi%(k%)
OUT &H3C9, bi%(k%)

NEXT k%



END SUB

SUB palget

FOR k% = 0 TO 255
OUT &H3C7, k%
r(k%) = INP(&H3C9)
g(k%) = INP(&H3C9)
b(k%) = INP(&H3C9)

NEXT k%

END SUB

SUB pallete (pl%)


SELECT CASE pl%


CASE 1

FOR i% = 0 TO 63
OUT &H3C8, i%
OUT &H3C9, i%
OUT &H3C9, 0
OUT &H3C9, i%
NEXT i%

FOR i% = 64 TO 127
OUT &H3C8, i%
OUT &H3C9, 63
OUT &H3C9, i% - 64
OUT &H3C9, 127 - i%
NEXT i%

FOR i% = 128 TO 191
OUT &H3C8, i%
OUT &H3C9, 63
OUT &H3C9, 191 - i%
OUT &H3C9, 0
NEXT i%

FOR i% = 192 TO 255
OUT &H3C8, i%
OUT &H3C9, 255 - i%
OUT &H3C9, 0
OUT &H3C9, 0
NEXT i%


CASE 2

FOR k% = 0 TO 63

OUT &H3C8, k%
OUT &H3C9, k%
OUT &H3C9, k% / 1.5
OUT &H3C9, 0

NEXT k%

FOR k% = 64 TO 127

OUT &H3C8, k%
OUT &H3C9, 127 - k%
OUT &H3C9, 42 + (k% - 64) \ 3
OUT &H3C9, 0

NEXT k%

FOR k% = 128 TO 191

OUT &H3C8, k%
OUT &H3C9, (k% - 128) \ 3
OUT &H3C9, 191 - k%
OUT &H3C9, k% - 128

NEXT k%

FOR k% = 192 TO 255

OUT &H3C8, k%
OUT &H3C9, (255 - k%) \ 3
OUT &H3C9, 0
OUT &H3C9, 255 - k%

NEXT k%


CASE 3

FOR k% = 0 TO 127

OUT &H3C8, k%
OUT &H3C9, k% \ 8
OUT &H3C9, k% \ 2
OUT &H3C9, k% \ 4

NEXT k%

FOR k% = 128 TO 255

OUT &H3C8, k%
OUT &H3C9, (255 - k%) \ 8
OUT &H3C9, (255 - k%) \ 2
OUT &H3C9, (255 - k%) \ 4

NEXT k%


CASE 4

FOR k% = 0 TO 127

OUT &H3C8, k%
OUT &H3C9, k% \ 2
OUT &H3C9, k% \ 4
OUT &H3C9, k% \ 2

NEXT k%

FOR k% = 128 TO 255

OUT &H3C8, k%
OUT &H3C9, (255 - k%) \ 2
OUT &H3C9, (255 - k%) \ 4
OUT &H3C9, (255 - k%) \ 2

NEXT k%


CASE ELSE

END SELECT


END SUB

SUB physix (toing%, pn%)

SELECT CASE toing%

CASE 1

t(pn%) = t(pn%) + .001
v(pn%) = v(pn%) + f(pn%) * t(pn%)
x(pn%) = x(pn%) + v(pn%)
IF v >= 0 THEN v = 0: f = 0
xp%(pn%) = x(pn%)
IF xp%(pn%) = x(pn%) THEN x(pn%) = x(pn%) + (xp%(pn%) - x(pn%))

CASE 2

t(pn%) = t(pn%) + .0001
v(pn%) = v(pn%) + f(pn%) * t(pn%)
x(pn%) = x(pn%) + v(pn%)

IF x(pn%) < 30 AND kat%(pn%) = 1 THEN x(pn%) = 30: f(pn%) = el(pn%): kat%(pn%) = 0
IF x(pn%) > 30 AND kat%(pn%) = 0 THEN x(pn%) = 30: f(pn%) = -el(pn%): kat%(pn%) = 1
xp%(pn%) = x(pn%)
IF xp%(pn%) = x(pn%) THEN x(pn%) = x(pn%) + (xp%(pn%) - x(pn%))

CASE 3

v(pn%) = v(pn%) + ep(pn%)
x(pn%) = x(pn%) + v(pn%)
xp%(pn%) = x(pn%)
IF xp%(pn%) = x(pn%) THEN x(pn%) = x(pn%) + (xp%(pn%) - x(pn%))

CASE 4

ep(pn%) = ep(pn%) + epe(pn%)
v(pn%) = v(pn%) + ep(pn%)
x(pn%) = x(pn%) + v(pn%)
xp%(pn%) = x(pn%)
IF xp%(pn%) = x(pn%) THEN x(pn%) = x(pn%) + (xp%(pn%) - x(pn%))

CASE ELSE

END SELECT


END SUB

SUB physix2

SHARED t, v, y, f, yp%, fps%

IF fps% > 500 THEN f = 4
t = t + .001
v = v + f * t
y = y + v
IF v >= 0 THEN v = 0: f = 0
yp% = y

END SUB

SUB plasmas (ps%, xl%, yl%, xp%, yp%)

SHARED mk%, k1%



SELECT CASE ps%

CASE 1

p% = 128 * (-1) ^ k1%
ypp% = 0

k1% = k1% + 1
IF k1% = 284 THEN k1% = 0
mk% = mk% + 1

xf1% = xp%
xf2% = xp% + xl%
IF xf1% < 1 THEN xf1% = 1
IF xf2% > 319 THEN xf2% = 319
yf1% = yp%
yf2% = yp% + yl%
IF yf1% < 0 THEN yf1% = 0
IF yf2% > 199 THEN yf2% = 199


ypp% = yf1% * 20


FOR y% = yf1% TO yf2%
ypp% = ypp% + 20
DEF SEG = &HA000 + ypp%

FOR x% = xf1% TO xf2%

p% = -p%

POKE x%, fsin3%(x% - xp% + p%) + fsin1%(x% - xp% + p% + k1%) + fsin2%(y% - yp% + p%)

NEXT x%
NEXT y%


CASE 2

p% = 64 * (-1) ^ k1%
k1% = k1% + 1
IF k1% = 284 THEN k1% = 0
mk% = mk% + 1

px% = SIN(mk% / 128) * 128
py% = SIN(mk% / 92) * 92


xf1% = xp%
xf2% = xp% + xl%
IF xf1% < 1 THEN xf1% = 1
IF xf2% > 319 THEN xf2% = 319
yf1% = yp%
yf2% = yp% + yl%
IF yf1% < 0 THEN yf1% = 0
IF yf2% > 199 THEN yf2% = 199

ypp% = yf1% * 20

FOR y% = yf1% TO yf2%

ypp% = ypp% + 20
DEF SEG = &HA000 + ypp%

FOR x% = xf1% TO xf2%

p% = -p%
c% = fsin1%(x% + px%) + fsin2%(y% + py%)
c% = fsin3%(p% + y% + c% + k1%) + p% + x%

POKE x%, fsin2%(p% + x% - k1%) + fsin3%(fsin1%(y% - k1%) - fsin3%(x% - k1% - c%))

NEXT x%
NEXT y%


CASE 3

p% = 163 * (-1) ^ k1%

mk% = mk% + 1
k1% = k1% + 1

IF k1% = 491 THEN k1% = 0

xf1% = xp%
xf2% = xp% + xl%
IF xf1% < 1 THEN xf1% = 1
IF xf2% > 319 THEN xf2% = 319
yf1% = yp%
yf2% = yp% + yl%
IF yf1% < 0 THEN yf1% = 0
IF yf2% > 199 THEN yf2% = 199



ypp% = yf1% * 20

FOR y% = yf1% TO yf2%
DEF SEG = &HA000 + ypp%
ypp% = ypp% + 20

FOR x% = xf1% TO xf2%

p% = -p%
c% = fsin1%(x%) + fsin1%(y%)

POKE x%, fsin1%(c% + x% + k1% - fsin1%(p% + y% - k1%)) - p% + x%

NEXT x%
NEXT y%


CASE 4

mk% = mk% + 1
k1% = k1% + 1
IF k1% = 504 THEN k1% = 0

xf1% = xp%
xf2% = xp% + xl%
IF xf1% < 1 THEN xf1% = 1
IF xf2% > 319 THEN xf2% = 319
yf1% = yp%
yf2% = yp% + yl%
IF yf1% < 0 THEN yf1% = 0
IF yf2% > 199 THEN yf2% = 199

ypp% = yf1% * 20

FOR y% = yf1% TO yf2%

DEF SEG = &HA000 + ypp%
ypp% = ypp% + 20


FOR x% = xf1% TO xf2%

c% = fsin1%(x% - xp% - k1%) + fsin1%(y% - yp% + k1%) + y%
c% = fsin3%(c% + fsin2%(x% - xp% + k1%) - y% - yp% + k1%) + x%
POKE x%, fsin2%(x% - xp% - y% - yp% + k1%) + fsin1%(y% - yp% - fsin2%(x% - xp% - k1% + c%))

NEXT x%
NEXT y%



CASE ELSE

END SELECT


END SUB

SUB preparewriter (pg%)



c$ = " "
f$ = "elitext1.dat"
kf% = 0
OPEN f$ FOR BINARY AS #1


REM  ---------- vriskimo Header position -------

kf% = 1

FOR i% = 2 TO pg%
GET #1, kf%, c$
c% = ASC(c$)
kf% = kf% + c% + 201
NEXT i%


REM  ---------- Parsimo pliroforion apo Header kai letter positions --------

GET #1, kf%, c$
ltp% = ASC(c$)

DIM ltp%(ltp%)

FOR lt% = 1 TO ltp%
kf% = kf% + 1
GET #1, kf%, c$
ltp%(lt%) = ASC(c$)
NEXT lt%


REM  ---------- Parsimo keimenou 20*10 ---------------



FOR lne% = 1 TO 10

FOR xl% = 1 TO 20

kf% = kf% + 1

GET #1, kf%, c$
txt%(lne%, xl%) = ASC(c$)


NEXT xl%

NEXT lne%

CLOSE


REM  ----------  Oikonomiko etoimasma ton grafikon ton xaraktiron ------

f$ = "fonts16a.fnt"
OPEN f$ FOR BINARY AS #1

FOR lt% = 1 TO ltp%

kf% = 0
FOR y% = 1 TO 16
FOR x% = 1 TO 16
kf% = kf% + 1
GET #1, kf% + ltp%(lt%) * 256, c$
c% = ASC(c$)
ltr%(lt%, x%, y%) = c%

NEXT x%
NEXT y%

NEXT lt%


CLOSE #1

END SUB

SUB rotozoom (angle%, zf%, xl%, yl%)

SHARED vsync%

SHARED k1%

xg% = 160: yg% = 200
r% = SQR(xg% ^ 2 + yg% ^ 2)
xw% = 120: yw% = 75
sc% = 1
xgg% = xg% \ 2
ygg% = yg% \ 2

IF vsync% = 1 THEN endcpumeter (0)
IF vsync% < 2 THEN WAIT &H3DA, 8: WAIT &H3DA, 8, 8
IF vsync% = 1 THEN startcpumeter

rr% = -r% \ 2


fcos% = COS(k1% / angle%) * 128
fsin% = SIN(k1% / angle%) * 128


ay1% = rr% * fsin%
ay2% = rr% * fcos%

ax1% = rr% * fcos%
ax2% = rr% * fsin%

FOR x% = -160 TO 160
ax1%(x%) = ax1% / zf% + 1
ax2%(x%) = ax2% / zf% + 1
lx1%(x%) = (ax1% / zf% - ax1%(x%)) * 512
lx2%(x%) = (ax2% / zf% - ax2%(x%)) * 512
ax1% = ax1% + fcos%: ax2% = ax2% + fsin%
NEXT x%


xl0% = xl% \ 2: xm0% = -xl0%
yl0% = yl% \ 2: ym0% = -yl0%

REM ----------------------------

yp% = (100 - yl0%) * 20
xp% = xl0% + 160 - xl0%

FOR y% = ym0% TO yl0%
DEF SEG = &HA000 + yp%
yp% = yp% + 20

ay1%(y%) = ay1% / zf%
ay2%(y%) = ay2% / zf%
ly1%(y%) = (ay1% / zf% - ay1%(y%)) * 512
ly2%(y%) = (ay2% / zf% - ay2%(y%)) * 512
ay1% = ay1% + fsin%: ay2% = ay2% + fcos%


FOR x% = xm0% TO xl0%

lx% = fsin1%(lx1%(x%) - ly1%(y%)) + xgg%
ly% = fsin1%(lx2%(x%) + ly2%(y%)) + ygg%

c% = cs%(fsin2%(ax1%(x%) - ay1%(y%) + lx%), fsin3%(ax2%(x%) + ay2%(y%) + ly%))

POKE x% + xp%, c%

NEXT x%
NEXT y%

IF vsync% = 1 THEN endcpumeter (0)

END SUB

SUB sines (sn%)

SELECT CASE sn%

CASE 1


FOR i% = -127 TO 730
fsin1%(i%) = SIN(i% / 45) * 97
fsin2%(i%) = SIN(i% / 35) * 128 + SIN(i% / 17) * 72
fsin3%(i%) = SIN(i% / 17) * 72
NEXT i%

CASE 2

FOR i% = -698 TO 890
fsin1%(i%) = SIN(i% / (45)) * 160
fsin2%(i%) = SIN(i% / (22.5)) * 64
fsin3%(i%) = SIN(i% / (15)) * 32
NEXT i%

CASE 3

FOR i% = -741 TO 1024
fsin1%(i%) = SIN(i% / 78) * 78
NEXT


CASE 4

FOR i% = -1024 TO 1024
fsin1%(i%) = SIN(i% / 20) * 45
fsin2%(i%) = SIN(i% / 40) * 90
fsin3%(i%) = SIN(i% / 80) * 75

NEXT i%

CASE ELSE
END SELECT



END SUB

SUB startcpumeter

OUT &H3C8, 0
OUT &H3C9, 63
OUT &H3C9, 0
OUT &H3C9, 0

END SUB

SUB testwriter

REM  ---------- Typoma se 20*10 gia test ----------------

plne% = 0
FOR lne% = 1 TO 10
plne% = plne% + 320

FOR i% = 1 TO 20

py% = 0
FOR y% = 1 TO 16
py% = py% + 20
DEF SEG = &HA000 + py% + plne%

FOR x% = 1 TO 16

POKE x%, ltr%(txt%(lne%, i%), x%, y%)

NEXT x%
NEXT y%

NEXT i%

NEXT lne%


END SUB

SUB text2array (lne%, tsa%)

px% = -16
py% = -320
xp% = tsa% * 5120 + 640

FOR xl% = 1 TO 20
px% = px% + 16

ltr% = txt%(lne%, xl%)

FOR y% = 1 TO 16
py% = py% + 320

FOR x% = 1 TO 16
c%(xp% + x% + px% + py%) = ltr%(ltr%, x%, y%)

NEXT x%
NEXT y%
py% = -320

NEXT xl%



END SUB

SUB writetext (xtp%, ytp%, lne%, ag%, bg%, xel%, xmeg%, yel%, ymeg%)

px% = -16
FOR xl% = ag% TO bg%
px% = px% + 16

ltr% = txt%(lne%, xl%)

py% = ytp% * 20
yp% = ytp%
FOR y% = 1 TO 16
DEF SEG = &HA000 + py%
py% = py% + 20: yp% = yp% + 1
IF yp% < yel% OR yp% > ymeg% THEN GOTO 39

FOR x% = 1 TO 16

xp% = x% + xtp% + px%
IF xp% <= xmeg% AND xp% >= xel% THEN POKE xp%, ltr%(ltr%, x%, y%)

NEXT x%
39
NEXT y%

NEXT xl%


END SUB

SUB zoomebaby (zf)


FOR i% = -160 TO 159
fsin1%(i%) = i% / zf
NEXT i%

yp% = 0

FOR y% = -99 TO 99
DEF SEG = &HA000 + yp%
yp% = yp% + 20

FOR x% = -160 TO 159

POKE x% + 160, c%(fsin2%(fsin1%(x%)) + fsin3%(fsin1%(y%)))

NEXT x%
NEXT y%

END SUB

